﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Linq.Expressions;
using System.Diagnostics;
using System.Reflection;

namespace IRC.IRepairClouds.DataLayer.Expressions
{
    partial class Extensions
    {
        public static InvocationExpressionBuilder<T> Invoke<T>(this ExpressionBuilder<T> expression, params ExpressionBuilder[] arguments)
        {
            return Expression.Invoke(expression, arguments.Select(i => i.Expression).ToArray());//.ToExpressionBuilder<T>();
        }

        public static InvocationExpressionBuilder<T> Invoke<T>(this ExpressionBuilder<T> expression, IEnumerable<ExpressionBuilder> arguments)
        {
            return Expression.Invoke(expression, arguments.Select(i => i.Expression));//.ToExpressionBuilder<T>();
        }
    }
}
